package com.cdwang.websocket_module.websocket;

import android.util.Log;


import org.java_websocket.client.WebSocketClient;
import org.java_websocket.drafts.Draft_6455;
import org.java_websocket.handshake.ServerHandshake;

import java.net.URI;

public class JWebSocketClient extends WebSocketClient {
    private SendInfo sendInfo;
    public JWebSocketClient(URI serverUri) {
        super(serverUri, new Draft_6455());
    }
    public JWebSocketClient(URI serverUri,SendInfo mSendInfo) {
        super(serverUri, new Draft_6455());
        this.sendInfo=mSendInfo;
    }

    public SendInfo getSendInfo(){
        return sendInfo;
    }

    @Override
    public void onOpen(ServerHandshake handshakedata) {
        Log.e("JWebSocketClient", "onOpen()");
    }

    @Override
    public void onMessage(String message) {
        Log.e("JWebSocketClient", "onMessage()");
    }

    @Override
    public void onClose(int code, String reason, boolean remote) {
        Log.e("JWebSocketClient", "onClose()"+code+"---"+reason);

    }

    @Override
    public void onError(Exception ex) {
        ex.printStackTrace();
        Log.e("JWebSocketClient", "onError()"+ex.getMessage());
    }
}
